class Petal
{
    public stretchA;
    public stretchB;
    public startAngle;
    public angle;
    public bloom:Bloom;
    public growFactor;
    public r;
    public isfinished;
    public constructor(stretchA,stretchB,startAngle,angle,growFactor,bloom:Bloom)
    {
        this.stretchA = stretchA;
        this.stretchB = stretchB;
        this.startAngle = startAngle;
        this.angle = angle;
        this.bloom = bloom;
        //this.bloom.garden.ctx.addChild(this);
        this.growFactor = growFactor;
        this.r = 1;
        this.isfinished = false;
    }
    public draw()
    {
        //var a = this.bloom.garden;
        var e = new Vector(0,this.r).rotate(Garden.degrad(this.startAngle));
        var d = e.clone().rotate(Garden.degrad(this.angle));
        var c = e.clone().mult(this.stretchA);
        var b = d.clone().mult(this.stretchB);
        this.bloom.graphics.lineStyle(1,this.bloom.c.color,this.bloom.c.alpha);
        //this.graphics.beginPath();
        this.bloom.graphics.moveTo(e.x,e.y);
        this.bloom.graphics.cubicCurveTo(c.x,c.y,b.x,b.y,d.x,d.y);
        //this.graphics.stroke();
    }
    public render()
    {
        if(this.r <= this.bloom.r)
        {
            this.r += this.growFactor;
            this.draw();
        }
        else
        {
            this.isfinished = true;
        }
    }
}